// userName.js
var ajax = require("../../utils/network.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  formSubmit(e) {
    let that = this;
    let username = e.detail.value.username;
    if (username == '') {
      wx.showModal({
        content: '请输入新的昵称',
        confirmColor: '#12bbcd',
        showCancel: false
      })
      return false
    }
    let token = wx.getStorageSync("token");
    let URL = ajax.server() + 'member/update-info?token=' + token;
    let Params = {
      member_name: username
    };
    let Method = 'POST';
    let Message = '';
    ajax.requestPost(URL, Params, Method, Message, function (res) {
      console.log('修改名称---', res);
      if (res.status == true){
        wx.showToast({
          title: res.msg,
        })
        wx.navigateBack()
      }
    }, function () {})
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },
})